import { defineConfig, ConfigEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
//引入mock接口 
import { viteMockServe } from 'vite-plugin-mock'
// https://vitejs.dev/config/
import path from 'path'

export default defineConfig(({ command }: ConfigEnv) => {
  return {
    plugins: [
      vue(),
      viteMockServe({
        mockPath: 'mock',
        localEnabled: command === 'serve',
      }),
    ],
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './src')
      }
    },
    CSS:{
      preprocessCSS:{
        javascriptEnable:true,
        additionalData:'@import "./src/styles/variable.scss";'
      }
    }
  }
})